<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
	//将"i love javascript cai guai"的每个单词的第一个字母，变为大写。
	//I Love Javascript Cai Guai
	//分析：love => Love  toUpperCase()
	//[i, love, ...]
	var str = 'i love javascript cai guai';
	var arr = str.split(' ');
	console.log(arr);//arr = ["i", "love", "javascript", "cai", "guai"]
	//var aa = arr[1];// love 字符串可以用字符串的方法
	//var bb = aa[0].toUpperCase(); //L
	//var cc = aa.substring(1); //ove
	//console.log(bb + cc);
	
	var newArr = [];
	for(var i = 0; i < arr.length; i++){
		newArr.push(arr[i][0].toUpperCase() + arr[i].substring(1));
	};
	console.log(newArr.join(' '));
</script>
